home *** CD-ROM | disk | FTP | other *** search
/ Risc World 3 / Risc World 3.iso / SOFTWARE / ISSUE2 / PD / CAMPINS.ZIP / resources / getlink (.txt) < prev    next >
RISC OS BBC BASIC V Source  |  2002-01-21  |  3KB  |  170 lines

  1.  V 1.30 
  2.  Stuart Halliday
  3.  finds string and then looks for the first 'HREF' and gets that url
  4.  if string starts with '--' then searcg backwards to find 'HREF'
  5.  "err:";
  6. ;" at ";
  7.  buffer% 512
  8.  "OS_GetEnv" 
  9.  buffer%
  10.  command$=
  11. getstring(buffer%)
  12.     3path$=
  13. command$,
  14. (command$)-
  15. command$,""" ")-1)
  16. path$,1)=
  17.  path$=
  18. path$,2)
  19. path$,1)=
  20.  path$=
  21. path$,
  22.  path$-1)
  23. string$=path$
  24. string$,2)="--" 
  25.    string$=
  26. string$,3)
  27.    negsearch%=
  28.    negsearch%=
  29.  PRINT string$
  30.  "OS_GSTrans","<campin$dir>",buffer%,512
  31. +todaypath$=
  32. getstring(buffer%)+".today"
  33. "OS_Find",&40,todaypath$ 
  34.  handle%
  35. length%=
  36.  string$
  37. string$,A%,1)
  38.        M$=
  39. string$,A%,1)
  40.        C$=
  41. #handle%
  42.        
  43.  C$=M$ 
  44.         
  45.    PRINT C$;
  46.           A%+=1
  47.         
  48.           A%=1 
  49.        
  50. .     
  51. #handle% 
  52.  A%>length%
  53.  PRINT PTR#handle%, A%,length%,M$,negsearch%
  54.  A%> length%  
  55.  negsearch%=
  56.     flag%=
  57. 7        
  58.       pos%=
  59. #handle%
  60.       
  61. #handle%=pos%-1
  62. :q      
  63. uppercase(
  64. #handle%))="S" 
  65. uppercase(
  66. #handle%))="R"  
  67. uppercase(
  68. #handle%))="C" 
  69.  flag%=
  70.       
  71.       pos%=
  72. #handle%
  73.       
  74. #handle%=pos%-3
  75. >     
  76. #handle% <9 
  77.  flag%=
  78.     pos%=
  79. #handle%
  80. #handle%=pos%-1
  81.  PRINT PTR#handle%
  82. F     post%=
  83. gotoendof("HREF")
  84.  PRINT post%
  85. H        
  86.     dummy$=
  87. #handle%)
  88. J?    
  89.  dummy$<>
  90.  dummy$<>" " 
  91.  dummy$<>"'" 
  92.  dummy$<>"="
  93.     pos%=
  94. #handle%
  95. #handle%=pos%-1
  96.     string$=
  97. getfile
  98.  VDU4:     PRINT ">>";string$;"<<" :VDU5
  99. ("set URLstring "+string$)
  100. ("unset URLstring"  )
  101.  PRINT ">>";string$;"<<"
  102. #handle%
  103. gotoendof(text$)
  104.  length%
  105. length%=
  106.  text$
  107. text$=
  108. uppercase(text$)
  109.        M$=
  110. text$,A%,1)
  111. c&       C$=
  112. uppercase(
  113. #handle%))
  114.  PRINT C$;
  115.        
  116.  C$=M$ 
  117.           A%+=1
  118.         
  119.           A%=1
  120.        
  121. #handle% 
  122.  A%>length%
  123.  A%>length% 
  124. post%=
  125. #handle%
  126. post%=0
  127. =post%
  128. getfile
  129.  length%,text$
  130.   C$=
  131. #handle%)
  132.  C$<>
  133.  C$ <> " " 
  134.  C$ <> "<" 
  135.  C$ <> "'" 
  136.  text$+=C$
  137. #handle% 
  138.  C$=" " 
  139.  C$=">" 
  140.  C$="'"
  141. =text$
  142. getstring(ptr%)
  143. ~    p$=""
  144.  (?ptr%>31 
  145.  ?ptr%<256) 
  146. (p$)<255
  147.   c%=?ptr%
  148.    IF c%>=97 AND c%<=122 THEN c%-=32
  149.   p$+=
  150.   ptr%+=1
  151. uppercase(text$)
  152.  ntext$,r$,L%
  153. ntext$="":r$=""
  154.  text$
  155.  loop%=1 
  156. text$,loop%,1))
  157.  a% >= 65 
  158.  a% <= 122 
  159.  (a% 
  160.  32) = 32 
  161.  a%> 64 
  162.  a%<123 
  163.  a%=a%-32
  164.  a%>223 
  165.  a%<255 
  166.  a%=a%-32
  167.  IF a%=34 THEN a%=ASC("|")
  168.  ntext$+=r$
  169. =ntext$
  170.